package cn.yuanqiao.activiti.domain.dto;

/**
 * @ClassName: ProcessInstanceDTO
 * @Description: 类的描述
 * @author: lihuahua
 * @date: 2023/8/17 16:52
 * @Blog: huahuacoco.top
 */

import org.activiti.engine.runtime.ProcessInstance;

import java.util.Date;
import java.util.Map;
import java.util.Objects;

public class ProcessInstanceDTO implements ProcessInstance {
    private String id;
    private String processDefinitionId;
    private String processDefinitionName;
    private String processDefinitionKey;
    private Integer processDefinitionVersion;
    private String deploymentId;
    private String businessKey;
    private boolean suspended;
    private Map<String, Object> processVariables;
    private String tenantId;
    private String name;
    private String description;
    private String localizedName;
    private String localizedDescription;
    private Date startTime;
    private String startUserId;
    private String activityId;
    protected boolean isEnded;
    private String processInstanceId;
    private String parentId;
    private String superExecutionId;
    private String rootProcessInstanceId;
    private String parentProcessInstanceId;

    public ProcessInstanceDTO() {
    }

    public ProcessInstanceDTO(ProcessInstance processInstance) {
        this.id = processInstance.getId();
        this.processDefinitionId = processInstance.getProcessDefinitionId();
        this.processDefinitionName = processInstance.getProcessDefinitionName();
        this.processDefinitionKey = processInstance.getProcessDefinitionKey();
        this.processDefinitionVersion = processInstance.getProcessDefinitionVersion();
        this.deploymentId = processInstance.getDeploymentId();
        this.businessKey = processInstance.getBusinessKey();
        this.suspended = processInstance.isSuspended();
        this.processVariables = processInstance.getProcessVariables();
        this.tenantId = processInstance.getTenantId();
        this.name = processInstance.getName();
        this.description = processInstance.getDescription();
        this.localizedName = processInstance.getLocalizedName();
        this.localizedDescription = processInstance.getLocalizedDescription();
        this.startTime = processInstance.getStartTime();
        this.startUserId = processInstance.getStartUserId();
        this.isEnded = processInstance.isEnded();
        this.activityId = processInstance.getActivityId();
        this.processInstanceId = processInstance.getProcessInstanceId();
        this.parentId = processInstance.getParentId();
        this.superExecutionId = processInstance.getSuperExecutionId();
        this.rootProcessInstanceId = processInstance.getRootProcessInstanceId();
        this.parentProcessInstanceId = processInstance.getParentProcessInstanceId();



    }

    // Getter 和 Setter 方法

    @Override
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Override
    public String getProcessDefinitionId() {
        return processDefinitionId;
    }

    public void setProcessDefinitionId(String processDefinitionId) {
        this.processDefinitionId = processDefinitionId;
    }

    @Override
    public String getProcessDefinitionName() {
        return processDefinitionName;
    }

    public void setProcessDefinitionName(String processDefinitionName) {
        this.processDefinitionName = processDefinitionName;
    }

    @Override
    public String getProcessDefinitionKey() {
        return processDefinitionKey;
    }

    public void setProcessDefinitionKey(String processDefinitionKey) {
        this.processDefinitionKey = processDefinitionKey;
    }

    @Override
    public Integer getProcessDefinitionVersion() {
        return processDefinitionVersion;
    }

    public void setProcessDefinitionVersion(Integer processDefinitionVersion) {
        this.processDefinitionVersion = processDefinitionVersion;
    }

    @Override
    public String getDeploymentId() {
        return deploymentId;
    }

    public void setDeploymentId(String deploymentId) {
        this.deploymentId = deploymentId;
    }

    @Override
    public String getBusinessKey() {
        return businessKey;
    }

    public void setBusinessKey(String businessKey) {
        this.businessKey = businessKey;
    }

    @Override
    public boolean isSuspended() {
        return suspended;
    }

    @Override
    public boolean isEnded() {
        return isEnded;
    }

    @Override
    public String getActivityId() {
        return activityId;
    }

    @Override
    public String getProcessInstanceId() {
        return processInstanceId;
    }

    @Override
    public String getParentId() {
        return parentId;
    }

    @Override
    public String getSuperExecutionId() {
        return superExecutionId;
    }

    @Override
    public String getRootProcessInstanceId() {
        return rootProcessInstanceId;
    }

    @Override
    public String getParentProcessInstanceId() {
        return parentProcessInstanceId;
    }

    public void setSuspended(boolean suspended) {
        this.suspended = suspended;
    }

    @Override
    public Map<String, Object> getProcessVariables() {
        return processVariables;
    }

    public void setProcessVariables(Map<String, Object> processVariables) {
        this.processVariables = processVariables;
    }

    @Override
    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }

    @Override
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getLocalizedName() {
        return localizedName;
    }

    public void setLocalizedName(String localizedName) {
        this.localizedName = localizedName;
    }

    @Override
    public String getLocalizedDescription() {
        return localizedDescription;
    }

    public void setLocalizedDescription(String localizedDescription) {
        this.localizedDescription = localizedDescription;
    }

    @Override
    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    @Override
    public String getStartUserId() {
        return startUserId;
    }

    public void setStartUserId(String startUserId) {
        this.startUserId = startUserId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ProcessInstanceDTO that = (ProcessInstanceDTO) o;
        return suspended == that.suspended &&
                Objects.equals(id, that.id) &&
                Objects.equals(processDefinitionId, that.processDefinitionId) &&
                Objects.equals(processDefinitionName, that.processDefinitionName) &&
                Objects.equals(processDefinitionKey, that.processDefinitionKey) &&
                Objects.equals(processDefinitionVersion, that.processDefinitionVersion) &&
                Objects.equals(deploymentId, that.deploymentId) &&
                Objects.equals(businessKey, that.businessKey) &&
                Objects.equals(processVariables, that.processVariables) &&
                Objects.equals(tenantId, that.tenantId) &&
                Objects.equals(name, that.name) &&
                Objects.equals(description, that.description) &&
                Objects.equals(localizedName, that.localizedName) &&
                Objects.equals(localizedDescription, that.localizedDescription) &&
                Objects.equals(startTime, that.startTime) &&
                Objects.equals(startUserId, that.startUserId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, processDefinitionId, processDefinitionName, processDefinitionKey, processDefinitionVersion, deploymentId, businessKey, suspended, processVariables, tenantId, name, description, localizedName, localizedDescription, startTime, startUserId);
    }

    @Override
    public String toString() {
        return "ProcessInstanceDTO{" +
                "id='" + id + '\'' +
                ", processDefinitionId='" + processDefinitionId + '\'' +
                ", processDefinitionName='" + processDefinitionName + '\'' +
                ", processDefinitionKey='" + processDefinitionKey + '\'' +
                ", processDefinitionVersion=" + processDefinitionVersion +
                ", deploymentId='" + deploymentId + '\'' +
                ", businessKey='" + businessKey + '\'' +
                ", suspended=" + suspended +
                ", processVariables=" + processVariables +
                ", tenantId='" + tenantId + '\'' +
                ", name='" + name + '\'' +
                ", description='" + description + '\'' +
                ", localizedName='" + localizedName + '\'' +
                ", localizedDescription='" + localizedDescription + '\'' +
                ", startTime=" + startTime +
                ", startUserId='" + startUserId + '\'' +
                '}';
    }
}
